#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n, m, k;
    cin >> n >> m >> k;
    int l = -k, r = k;
    int ll = -k, rl = k;
    vector<int> v(n);
    vector<int> result;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }
    sort(v.begin(), v.end());
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a;
        if (a != 3)
        {
            cin >> b;
            if (a == 1)
            {
                r -= b;
                l -= b;
            }
            else
            {
                l += b;
                r += b;
            }
            rl = r < rl ? r : rl;
            ll = l > ll ? l : ll;
        }
        else
        {
            int count = 0;
            for (int j = 0; j < n; j++)
            {
                if (v[j] >= ll && v[j] <= rl)
                {
                    count++;
                }
            }
            result.push_back(count);
        }
    }
    for(auto &i : result)
    {
        cout << i << endl;
    }
    system("pause");
    return 0;
}